package tushare

import (
	"tushare/model/mysql"
)

type OpenDay struct {
	Id         int64   `json:"id"`
	TsCode     string  `json:"ts_code"`
	CreateTime string  `json:"create_time"`
	Percent    float64 `json:"percent"`
}

func OpenDayCreate(od OpenDay) {
	mysql.DB.Table("tushare_open_day").Create(&od)
}

func OpenDayList(page, pageSize int64) []OpenDay {
	page = page
	pageSize = pageSize
	offset := (page - 1) * pageSize

	od := []OpenDay{}
	mysql.DB.Table("tushare_open_day").Limit(pageSize).Offset(offset).Scan(&od)
	return od
}

func OpenDayCount() int64 {
	var count int64
	mysql.DB.Table("tushare_open_day").Count(&count)
	return count
}
